A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

ActiveRecord a Toy For Children


See also: Object-Relational-Mapping-Is-Double-Dipping
Found some interesting evidence that Active Record really is a toy for kids.

http://www.bytebot.net/blog/archives/2007/04/22/activerecord


"Complexity is best located in the code, not in the database, according to the Rails developers."

Laughing. I usually celebrate when I can let the database do work for me. It's like hiring somebody without having to pay them. When complexities can be outsourced into the database it is a good thing, not a bad thing.

It's funny how ruby people (kids?) are hot to advocate things like MVC (model view controller) and HTML templates... but when it comes to database work they just hard code all the database stuff into their objects as if the objects and database are one big pile of poop. Since they love cool acronyms like MVC maybe we should start a new trend and acronym called:

  Let The Database Do Some Work You Stupid Idiots
  Acronym: LTDDSWYSI
  Prounounced: LITIDDSWYZEE
...which would hopefully catch on just like the hyped MVC acronym they propagate.
"Avoid SQL injection with find. Use an array or let it do the quoting for you. By itself, it allows you to do stupid things - so avoid cross site scripting, etc."

Obviously these 'rails' children haven't heard of parameterized queries (a.k.a. server prepared statements, escaped sql templates).


"Some associations:
1. has_one - when the FK is in the OTHER table
2. belongs_to - when the FK is in THIS table
3. has_many
4. has_and_belongs_to_many"
No. Do you know what the word relational means? Have you ever used a database? Do you know what a database is? It is not a toy. Associations? What the hell happened to relations?


"ActiveRecord also allows for output formats - like to_yaml, to_xml, to_json. So your database records can become XML pretty easily."

A database cannot "become XML pretty easily". A database can be exported in a shitty format such as XML but please don't say that a database can "become XML".


"Rabble also gave us an anecdote from his Odeo days. They thought that grabbing feeds should be done in parallel. Which is when they used RubyThreads. And suddenly, they were getting some horrendous database problems, duplicate records and so on. Moral of the story: RubyThreads and ActiveRecord don’t mix. A member of the audience mentioned that using find_by_sql consumed about 1MB of memory in his application, however, using ActiveRecord to do the same thing was costing about 20MB per thread."
Why am I not laughing at this? Because it is so dumb that it isn't even funny.

About
This site is about programming and other things.
_ _ _